import { Component } from "react";
import axios from 'axios'

class App extends Component {
    state = {
        items: []
    }



    render() {
        console.log(this.state.items)
        return (
            this.state.items.map((value) => {
                return (
                    <div key={value.id}>
                        <p>{value.name}</p>
                    </div>
                )
            })
        )
    }

    componentDidMount() {
        axios.interceptors.response.use((res)=> {
            return res.data
        }) 

        axios.get('http://localhost:9999/data.json').then(
            (value) => {
                this.setState({
                    items: value.items
                })
            }
        )
    }
}
export default App